package com.mcr.graduateprogram.controller;


import com.mcr.graduateprogram.common.R;
import com.mcr.graduateprogram.service.IGamekeysService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author graduateprogram
 * @since 2023-02-25
 */
@Api(tags = "游戏激活码相关接口")
@CrossOrigin
@RestController
@RequestMapping("/graduateprogram/keys")
public class GamekeysController {
    @Autowired
    private IGamekeysService gamekeysService;
    @ApiOperation(value = "解析上传的激活码数据")
    @PostMapping("ayalysisKeysData")
    @CacheEvict(value = "graduationProgram",key = "'allGameSpaceification'")//删缓存allGameSpaceification
    public R ayalysisKeysData(@RequestPart("keysExcel")MultipartFile keysExcel){
        gamekeysService.ayalysisKeys(keysExcel);
        return R.success(null);
    }
}
